#pragma once

#include "Deinterlace.h"
#include "ui_Main_Wnd.h"

class Protocol;


class Main_Wnd : public QMainWindow
{
public:
	Main_Wnd(QWidget *parent = 0);
	~Main_Wnd();

	const Protocol& get_protocol() const;
	
	Deinterlacer::Method get_deinterlace_method() const;
	bool get_smooth_resize() const;

private:
	void update();
	void start();

	void toggle_fullscreen();
	void toggle_capture();
	void set_camera(uint32_t idx);

	Ui::Main_WndClass m_ui;

	cv::VideoCapture m_capture;
	cv::VideoWriter m_writer;
	cv::Mat m_frame_bgr;
	cv::Mat m_frame;
	cv::Mat m_frame_resized;
	Deinterlacer::Method m_deinterlace_method;
	bool m_smooth_resize;
	bool m_is_frame_ready;
	bool m_has_capture_device;

	std::unique_ptr<Protocol> m_protocol;

	Deinterlacer m_deinterlacer;
};
